using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;

namespace Vms.Web.Models
{
    public class VmsWebContext : DbContext
    {
        // You can add custom code to this file. Changes will not be overwritten.
        // 
        // If you want Entity Framework to drop and regenerate your database
        // automatically whenever you change your model schema, add the following
        // code to the Application_Start method in your Global.asax file.
        // Note: this will destroy and re-create your database with every model change.
        // 
        // System.Data.Entity.Database.SetInitializer(new System.Data.Entity.DropCreateDatabaseIfModelChanges<Vms.Web.Models.VmsWebContext>());
        public VmsWebContext()
            : base("name=VmsConnection")
        {
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<SCREEN>()
                        .HasRequired(a => a.ScreenStatus)
                        .WithMany()
                        .HasForeignKey(u => u.ScreenStatus_Id).WillCascadeOnDelete();

            modelBuilder.Entity<SCREEN>()
                        .HasRequired(a => a.ScreenBrightness)
                        .WithMany()
                        .HasForeignKey(u => u.ScreenBrightness_Id);//.WillCascadeOnDelete(false);
        }
        public DbSet<Vms.Web.Models.USER> USERS { get; set; }

        public DbSet<Vms.Web.Models.SCREEN> SCREENS { get; set; }

        public DbSet<Vms.Web.Models.SCREEN_LOG> SCREEN_LOGS { get; set; }

        public DbSet<Vms.Web.Models.SCREEN_STATUS> SCREEN_STATUS { get; set; }

        public DbSet<Vms.Web.Models.SCREEN_BRIGHTNESS> SCREEN_BRIGHTNESS { get; set; }

        public DbSet<Vms.Web.Models.PROGRAM> PROGRAMS { get; set; }

        public DbSet<Vms.Web.Models.LOG> LOGS { get; set; }

        public DbSet<Vms.Web.Models.LIB_CONTENT> LIB_CONTENTS { get; set; }

        public DbSet<Vms.Web.Models.LIB_CONTENT_TXT> LIB_CONTENT_TXTS { get; set; }

        public DbSet<Vms.Web.Models.LIB_CONTENT_IMG> LIB_CONTENT_IMGS { get; set; }

        public DbSet<Vms.Web.Models.LIB_IMG> LIB_IMGS { get; set; }

        public DbSet<Vms.Web.Models.CONTENT> CONTENTS { get; set; }

        public DbSet<Vms.Web.Models.CONTENT_TXT> CONTENT_TXT { get; set; }

        public DbSet<Vms.Web.Models.CONTENT_IMG> CONTENT_IMG { get; set; }
    }
}